package org.jgs1904.apachepoidemo.reflection.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Arrays;

/**
 * @author: 默苍璃
 * @date: 2024-02-20 14:44
 */
public class DynamicProxy1 {
    public static void main(String[] args) throws Throwable {

        InvocationHandler handler = (proxy, method, args1) -> {
            System.out.println(method);
            if (method.getName().equals("morning")) {
                System.out.println("Good morning, " + args1[0]);
            }
            return null;
        };

        HelloDynamicProxy dynamicProxy1 = new HelloDynamicProxy(handler);
        dynamicProxy1.morning("Bob");

    }

}


